#ifndef __APP_DELEGATE_H__
#define __APP_DELEGATE_H__


#include "cocos2d.h"

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "TargetConditionals.h"
#endif

#include "EncryptChar.h"

/**
@brief    The cocos2d Application.

The reason for implement as private inheritance is to hide some interface call by Director.
*/
class  AppDelegate : private cocos2d::Application
{
public:
    AppDelegate();
    virtual ~AppDelegate();

    virtual void initGLContextAttrs();

    /**
    @brief    Implement Director and Scene init code here.
    @return true    Initialize success, app continue.
    @return false   Initialize failed, app terminate.
    */
    virtual bool applicationDidFinishLaunching();

    /**
    @brief  The function be called when the application enter background
    @param  the pointer of the application
    */
    virtual void applicationDidEnterBackground();

    /**
    @brief  The function be called when the application enter foreground
    @param  the pointer of the application
    */
    virtual void applicationWillEnterForeground();
    
    
    virtual void applicationDidReceiveMemoryWarning();
    
    virtual std::string getAppVersion() override;
    
    virtual std::string getRemoteAppVersion() override;
    
    virtual std::string getResourceVersion() override;
    
    virtual std::string getRemoteResourceVersion() override;
    
private:
    static EncryptChar* _encryKey;
    static const char* _encrySign;

public:
    static const std::string& getStorePath();
    static void setAppVersion(const std::string& s);
    static void setResourceVersion(const std::string& s);
    static const std::string& getExternalPath();
    static void initGameConfig();
    static void loadL10NStr(bool async);
    static void relaunchApp(bool withLog);
    static void removeAllCache();
    static void delayInit();
    static bool isGameLogin();
    static void restartApp();
    static void closeApp();
    static void launchClearScene();
    static void gsdkSetEvent(int tag, bool state, const char* msg, bool authorize, bool finish);
    static void setSearchPaths();
    static bool checkPermissions(const char * permissions);
    static void requestPermissions(const char * permissions);
    static void goAppSetting();
};

#endif  // __APP_DELEGATE_H__

